const { DataTypes } = require('sequelize');
const sequelize = require('./db');

const Events = sequelize.define('event', {
  FID: {
    type: DataTypes.INTEGER,
    allowNull: false,
    validate: {
      is: /^\d+$/,
    },
  },
  事件编号: {
    type: DataTypes.STRING,
    allowNull: false,
    validate: {
      len: [14, 14],
      is: /^SJ20181209-\d+$/,
    },
  },
  事件类型: {
    type: DataTypes.STRING,
    allowNull: false,
  },
  事件等级: {
    type: DataTypes.INTEGER,
    allowNull: false,
  },
  发生时间: {
    type: DataTypes.DATE,
    allowNull: false,
  },
  发生地点: {
    type: DataTypes.INTEGER,
    allowNull: false,
  },
  车牌号: {
    type: DataTypes.STRING,
    allowNull: false,
    validate: {
      len: [7, 7],
      is: /^鄂A-\d+$/,
    },
  },
  驾驶员: {
    type: DataTypes.STRING,
    allowNull: false,
  },
  处理状态: {
    type: DataTypes.INTEGER,
    allowNull: false,
    defaultValue: 0,
  },
  mpLayer: {
    type: DataTypes.INTEGER,
    allowNull: false,
    defaultValue: 0,
  },
  
},
{
    paranoid: true, //开启软删除
  }
);
module.exports = Events;